<template>
    <div  class="app-container">
   
                <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
                    label-width="68px">
                    <el-form-item label="项目名称" prop="projectName">
                        <el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable
                            @keyup.enter.native="handleQuery" />
                    </el-form-item>

                    <el-form-item>
                        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
                    </el-form-item>
                </el-form>

         
                <el-row :gutter="10" class="mb8">
                    <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
                </el-row>
                <el-table v-loading="loading" :data="InfoProjectList" @selection-change="handleSelectionChange">
                    <el-table-column label="项目名称" :show-overflow-tooltip="true" align="left" prop="questionTitle" />
                  
                    <el-table-column label="人数" :show-overflow-tooltip="true" align="left" prop="count" />
                    <el-table-column label="平均得分" :show-overflow-tooltip="true" align="left" prop="avgValue" />
                    <el-table-column label="操作" align="left" width="120" class-name="small-padding fixed-width">
                        <template slot-scope="scope">
                            <el-button size="mini" type="text" icon="el-icon-view" @click="handleDetails(scope.row)">查看</el-button>

                        </template>
                    </el-table-column>
                </el-table>

                <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                    :limit.sync="queryParams.pageSize" @pagination="getList" />
       
    </div>
</template>
<script>
import { getQuestionNaireList } from "../../api/InfoQuestionNaire/infoQuestionNaire"



export default {
    name: "InfoProject",
    data() {
        return {
            // 遮罩层
            loading: false,
            // 选中数组
            ids: [],
            // 非单个禁用
            single: true,
            // 非多个禁用
            multiple: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 项目信息表格数据
            InfoProjectList: [
                {projectName:"测试项目"}
            ],
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                projectName: null,
               
            },
            // 表单参数
            form: {},
            // 表单校验
            rules: {
            }
        };
    },
    created() {
        this.getList();
    },
    methods: {
        /** 查询项目信息列表 */
        getList() {
            this.loading = true;
            getQuestionNaireList(this.queryParams).then(response => {
                this.InfoProjectList = response.rows;
                this.total = response.total;
                this.loading = false;

            });


        },
        /** 上报 */
        handleEscalation(row) {
            if (!row.totalFundsExecuteRate || !row.monitorFinishStatus) {
                this.$message.error('请填写执行率和预计完成情况后再进行上报');
                return
            }

            this.$modal.confirm(`上报“${row.projectName}”?`).then(function () {
                let params = {
                    monitorId: row.id,
                    examineStatus: 1
                }
                return examineMonitor(params)
            }).then(() => {
                this.getList();
                this.$modal.msgSuccess("上报成功");
            }).catch(() => { this.getList() });
        },
        /**取消按钮 */
        cancel() {
            this.open = false;
            this.reset();
        },
        /** 搜索按钮操作 */
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },
        // 多选框选中数据
        handleSelectionChange(selection) {
            this.ids = selection.map(item => item.id)
            this.single = selection.length !== 1
            this.multiple = !selection.length
        },

        /** 修改按钮操作 */
        handleUpdate(row) {
            this.$router.push({
                path: '/MonitorS/Filling',
                query: { ids: row.id }
            })
        },
        /** 详情按钮操作 审核 */
        handleDetails(row) {
            this.$router.push({
                path: '/Questionnaire/listLook',
                query: { ids: row.evaluateId }
            })
        },
        /** 删除按钮操作 */
        handleDelete(row) {
            const ids = row.id || this.ids;
            this.$modal.confirm(`删除“${row.projectName}”?`).then(function () {
                return delInfoProject(ids);
            }).then(() => {
                this.getList();
                this.$modal.msgSuccess("删除成功");
            }).catch(() => { this.getList(); });
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('InfoProject/InfoProject/export', {
                ...this.queryParams
            }, `InfoProject_${new Date().getTime()}.xlsx`)
        }
    }
};
</script>
<style lang="scss" scoped></style>